@model System.Collections.Generic.IList<Omu.AwesomeDemo.Infra.Dto.FoobarInput>
@{
    ViewBag.Title = "index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@Html.ValidationSummary()
@using (Html.BeginForm())
{
    <ul class='ae-lookup-list'>
        @for (var i = 0; i < Model.Count; i++)
        {
            <li>
                @Html.HiddenFor(o => o[i].Id)
                <table>
                    <tbody>
                        <tr>
                            <td>
                                Name
                                <br />
                                <div class='einput'>
                                    @Html.TextBoxFor(o => o[i].Name)
                                </div>
                            </td>
                            <td>
                                Person<br />
                                <div class='einput'>
                                    @Html.LookupFor(o => o[i].Person, value: Model[i].Person)</div>
                            </td>
                            <td>
                                Person2<br />
                                <div class='einput'>
                                    @Html.LookupFor(o => o[i].Person2, value: Model[i].Person2, controller: "PersonLookup")</div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Show<br />
                                <div class='einput'>
                                    @Html.AjaxDropdownFor(m => m[i].Show, value: Model[i].Show)</div>
                            </td>
                            <td>
                                Character<br />
                                <div class="einput">
                                    @Html.AjaxDropdownFor(o => o[i].Character, value: Model[i].Character, controller: "PersonAjaxDropdown", parentId: "[" + i + "].Show")</div>
                            </td>
                            <td>
                                Hobby<br />
                                <div class="einput">
                                    @Html.AutocompleteFor(o => o[i].Hobby, value: Model[i].Hobby, maxResults: 5, generatePropId: false)
                                    @Html.HiddenFor(o => o[i].HobbyId, new { id = "_" + i + "__HobbyId" })
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </li>
        }
    </ul>
    <input type='submit' value='save foobars' />
}
